/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unipampa.model;

import br.unipampa.dados.DBCompromisso;
import br.unipampa.dados.DBConection;
import br.unipampa.dados.DBConfigCalendar;
import br.unipampa.view.ApoioDeInterface;
import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author Gabriel Moro
 * @since 15/03/2013
 * @version 1.2
 */
public class Calendario {

    private String nomeMes;
    private String ano;
    private int posicaoInicial;
    private int valorFinal;
    private DBConection conexao;
    private DBConfigCalendar dataBase;
    private DBCompromisso dataBaseII;

    public Calendario(String nomeMes, String ano) {
        this.nomeMes = nomeMes;
        this.ano = ano;
    }

    public ArrayList<Integer> recuperarEstruturaCalendar() {
        try {
            this.conexao = new DBConection();
            this.dataBase = new DBConfigCalendar(this.conexao.getCon());
            ArrayList<Integer> values= this.dataBase.selected(this.nomeMes, this.ano);
           return values;
        } catch (SQLException erroSql) {
            ApoioDeInterface.mensagemErroBanco(erroSql.getMessage());
        }finally{
            this.dataBase.closedConnection();
        }
        return null;
    }
    public ArrayList<Integer> montaPerfilDeCompromissos(){
        try {
            this.conexao = new DBConection();
            this.dataBaseII = new DBCompromisso(this.conexao.getCon());
            ArrayList<Integer> result = this.dataBaseII.selectEstatistica(this.ano, this.nomeMes);
            return result;
        } catch (SQLException erroSql) {
            ApoioDeInterface.mensagemErroBanco(erroSql.getMessage());
        }finally{
            this.dataBaseII.closedConnection();
        }
        return null;
    }
}
